<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-tool/circuits/number.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('number_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">number.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="bit_8h_source.html">bit.h</a>&quot;</code><br />
</div>
<p><a href="number_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a233c02e8010f3e9f62160b3fc5868c05"><td class="memTemplParams" colspan="2">template&lt;typename T , typename D &gt; </td></tr>
<tr class="memitem:a233c02e8010f3e9f62160b3fc5868c05"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="number_8h.html#a233c02e8010f3e9f62160b3fc5868c05">cmp_swap</a> (T *key, D *data, int i, int j, <a class="el" href="class_bit.html">Bit</a> acc)</td></tr>
<tr class="separator:a233c02e8010f3e9f62160b3fc5868c05"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada05ad9eb230db32857347bcacdfafd7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="number_8h.html#ada05ad9eb230db32857347bcacdfafd7">greatestPowerOfTwoLessThan</a> (int n)</td></tr>
<tr class="separator:ada05ad9eb230db32857347bcacdfafd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a995b0925e6e3fda7a003692d67203d2a"><td class="memTemplParams" colspan="2">template&lt;typename T , typename D &gt; </td></tr>
<tr class="memitem:a995b0925e6e3fda7a003692d67203d2a"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="number_8h.html#a995b0925e6e3fda7a003692d67203d2a">bitonic_merge</a> (T *key, D *data, int lo, int n, <a class="el" href="class_bit.html">Bit</a> acc)</td></tr>
<tr class="separator:a995b0925e6e3fda7a003692d67203d2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3093cb424e7435ba5c555049360d5903"><td class="memTemplParams" colspan="2">template&lt;typename T , typename D &gt; </td></tr>
<tr class="memitem:a3093cb424e7435ba5c555049360d5903"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="number_8h.html#a3093cb424e7435ba5c555049360d5903">bitonic_sort</a> (T *key, D *data, int lo, int n, <a class="el" href="class_bit.html">Bit</a> acc)</td></tr>
<tr class="separator:a3093cb424e7435ba5c555049360d5903"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6bd8a07f72acde85d8fcc48f33a56e11"><td class="memTemplParams" colspan="2">template&lt;typename T , typename D  = Bit&gt; </td></tr>
<tr class="memitem:a6bd8a07f72acde85d8fcc48f33a56e11"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="number_8h.html#a6bd8a07f72acde85d8fcc48f33a56e11">sort</a> (T *key, int size, D *data=nullptr, <a class="el" href="class_bit.html">Bit</a> acc=true)</td></tr>
<tr class="separator:a6bd8a07f72acde85d8fcc48f33a56e11"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a995b0925e6e3fda7a003692d67203d2a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a995b0925e6e3fda7a003692d67203d2a">&sect;&nbsp;</a></span>bitonic_merge()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename D &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void bitonic_merge </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>lo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_bit.html">Bit</a>&#160;</td>
          <td class="paramname"><em>acc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a3093cb424e7435ba5c555049360d5903"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3093cb424e7435ba5c555049360d5903">&sect;&nbsp;</a></span>bitonic_sort()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename D &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void bitonic_sort </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>lo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_bit.html">Bit</a>&#160;</td>
          <td class="paramname"><em>acc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a233c02e8010f3e9f62160b3fc5868c05"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a233c02e8010f3e9f62160b3fc5868c05">&sect;&nbsp;</a></span>cmp_swap()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename D &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void cmp_swap </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>i</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>j</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_bit.html">Bit</a>&#160;</td>
          <td class="paramname"><em>acc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ada05ad9eb230db32857347bcacdfafd7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada05ad9eb230db32857347bcacdfafd7">&sect;&nbsp;</a></span>greatestPowerOfTwoLessThan()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int greatestPowerOfTwoLessThan </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a6bd8a07f72acde85d8fcc48f33a56e11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6bd8a07f72acde85d8fcc48f33a56e11">&sect;&nbsp;</a></span>sort()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename D  = Bit&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void sort </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D *&#160;</td>
          <td class="paramname"><em>data</em> = <code>nullptr</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_bit.html">Bit</a>&#160;</td>
          <td class="paramname"><em>acc</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_eec959d81771dc8b1a750b834e1341eb.html">emp-tool</a></li><li class="navelem"><a class="el" href="dir_2b4671b717884caf3b3fe5ce6896c1bb.html">circuits</a></li><li class="navelem"><a class="el" href="number_8h.html">number.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
